package net.huashitong.Project.service;

import com.sirdc.modules.core.dao.BaseDao;
import com.sirdc.modules.sys.base.StringPKService;
import com.sirdc.modules.sys.service.SysTableService;
import net.huashitong.Project.dao.LeaderShipDao;
import net.huashitong.Project.entity.LeaderShip;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LeaderShipService extends StringPKService<LeaderShip> {
    @Override
    protected BaseDao<LeaderShip, String> getDao() {
        return dao;
    }

    @Autowired
    private LeaderShipDao dao;
    @Autowired
    private SysTableService tableService;

    @Override
    protected void beforeSave(LeaderShip obj) {
        obj.setSysId(tableService.updateMaxSysId("t_bnp_leader", null));
    }

    /**
     * 验证分管领导是否存在数据库
     * @return
     */
    public boolean getLeaderExist(String leaderName){
        return dao.verifyLeaderExist(leaderName);
    }

    public LeaderShip queryByLeaderName(String leaderName){
        return dao.queryByLeaderName(leaderName);
    }
}
